-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RF: revert to default cmp=True for attr.s. Rely on frozen to get hash generated #430
RF: revert to default cmp=True for attr.s. Rely on frozen to get hash generated #430
Conversation
Codecov Report
@@ Coverage Diff @@
## master #430 +/- ##
==========================================
- Coverage 89.95% 89.82% -0.13%
==========================================
Files 148 148
Lines 11742 12206 +464
==========================================
+ Hits 10562 10964 +402
- Misses 1180 1242 +62
Continue to review full report at Codecov.
|
So according to the tests at least it is all kosher... Will check more locally and merge if I don't run into side effects |
FWIW I also wasn't able to find any rationale for this after poking around a bit in the commit history, issues, and comments. Somewhat related attrs best practices question: Should we avoid explicitly setting |
I guess I will need to check commits around that point in time to recall to which dict we were adding those instances... May be it is no longer needed indeed, at least until #419 requires it |
…False * origin/master: ENH: VenvEnvironment: Add system_site_packages attribute TST: travis: Expose system packages for virtualenv tests BF: skip: Don't swallow AttributeError's from condition functions
I have looked around
I guess it depends on either we still depend on it as an ability to place those objects into some set or dict, to match their "identity". now there is also the |
The point isn't that hashing objects should be avoided; it's that
To use our DEBPackage as an example, following this advice for attr.s (and leaving the attr.ib's alone for now) would translate to diff --git a/reproman/distributions/debian.py b/reproman/distributions/debian.py
index b1de5c102..205b5e4d5 100644
--- a/reproman/distributions/debian.py
+++ b/reproman/distributions/debian.py
@@ -69,7 +69,7 @@ class APTSource(SpecObject):
_register_with_representer(APTSource)
-@attr.s(slots=True, frozen=True, hash=True)
+@attr.s(slots=True, frozen=True)
class DEBPackage(Package):
"""Debian package information"""
name = attrib(default=attr.NOTHING) The object would still be hashable:
|
See ReproNim#430 (comment) for more reasoning -- objects should still be hashable
ok, pushed fae7a7e which removed explicit |
So let's consider that no actual functionality is broken and merge? |
So let's consider that no actual functionality is broken and merge?
Given that no objections have been raised, sounds fine to me.
|
It is not clear if we really had to disable
cmp
which hinders simple comparison of our objects.Having some tests still failing locally (yet to troubleshoot), submitting to CI